<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = "7star1";	//語言檔參數，務必放在最前面
include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");

$fp = @file(__Membertemplate_Path."/7star1_".$_data["stype"].".html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
$fp = str_replace("{SelfFile}", $_SERVER["PHP_SELF"], $fp);
$fp = str_replace("{ShowAccount}", $_SESSION["Member_Info"] -> Account, $fp);
$fp = str_replace("{UserID}", $_SESSION["Member_Info"] -> ID, $fp);
$fp = str_replace("{sid}", $_data["sid"], $fp);

$intLID = (int)$_data["LottoID"];
if(empty($intLID))$intLID = 4;

$intBT = (int)$_data["Bet_Type"];
if(empty($intBT))$intBT = 1;

include_once(__Common_Path."/SysParam.inc.php");
include_once(__Common_Path."/limit/LottoLimit_".$intLID.".inc.php");
include_once(__Common_Path."/betparam/BetParam_".$intLID.".inc.php");
include_once(__Root_Path."/tmp/credit-".$_SESSION["Member_Info"] -> ID.".php");
@include_once(__Common_Path."/todaygame/Gamble".$intLID.".inc.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/ExchangeRate.inc.php");
include_once(__Modules_Path."/ChangeTime.lib.php");

$MemExchangeRate = (empty($_ECRate[$_SESSION["Member_Info"] -> ERID]["Rate"]))?1:$_ECRate[$_SESSION["Member_Info"] -> ERID]["Rate"];
//取出此期賽程
if(is_array($_arrGamble))list($intGID, $arrGamble) = each($_arrGamble);

$intTmp = $_SESSION["Member_Info"] -> CreditLine - $_arrMemStake["_SUM"];
$fp = str_replace("{CreditValue}", $intTmp, $fp);

$fp = str_replace("{LottoID}", $intLID, $fp);
$fp = str_replace("{Bet_Type}", $intBT, $fp);

if (!is_array($arrGamble)) {
	$strDate = "2100-01-01 01:01:01";
} else {
	$strDate = TimeForm($arrGamble[GameDate], $arrGamble[EndGameTime], "Y-m-d H:i:s", "UToC");
}
$fp = str_replace("{EndGameTime}", $strDate, $fp);
$fp = str_replace("{GambleID}", $intGID, $fp);

$fp = str_replace("<td class=\"rt_sp_nsbar\" id=\"NSBar".(string)$intBT."\"", "<td class=\"rt_sp_nsbar_sd\" id=\"NSBar".(string)$intBT."\"", $fp);
$fp = str_replace("{Title}", $_arrBet_Type[$_arrLotto[$intLID]["LType"]][$intBT], $fp);
$fp = str_replace("{MSite}", "2", $fp);	//走馬燈位置
$intGap = 0;

$intMinStakeValue = 9999999;
$intChkMaxPayOff = 9999999;
foreach($_arrBetParam[$intBT] as $intAN => $arrBP){
	if(floor($arrBP["MinStake"] / $MemExchangeRate) < $intMinStakeValue)$intMinStakeValue = floor($arrBP["MinStake"] / $MemExchangeRate);
	if(floor($arrBP["MaxPayOff"] / $MemExchangeRate) < $intChkMaxPayOff)$intChkMaxPayOff = floor($arrBP["MaxPayOff"] / $MemExchangeRate);
}

$fp = str_replace("{MaxEventLimitValue}", $_SESSION["Member_Info"] -> arrEventLimit[$intLID][$intBT], $fp);
$fp = str_replace("{MaxBetLimitValue}", $_SESSION["Member_Info"] -> arrBetLimit[$intLID][$intBT], $fp);
$fp = str_replace("{LottoMaxEventLimitValue}", floor($_arrLottoLimit[$intBT][0] / $MemExchangeRate), $fp);
$fp = str_replace("{LottoMaxBetLimitValue}", floor($_arrLottoLimit[$intBT][1] / $MemExchangeRate), $fp);
$fp = str_replace("{MinStakeValue}", $intMinStakeValue, $fp); //最低下注金額
$fp = str_replace("{chkMaxPayOff}", $intChkMaxPayOff, $fp);	//最高派彩

while(list($k, $v) = each($_str7Star1)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>